# GovRptWordCloud.py
import jieba
import wordcloud
from imageio import imread

mask = imread('chinamap.png')
excludes = {'的', '和', '是', '在'}
f = open('新时代中国特色社会主义.txt', 'r', encoding='utf-8')
t = f.read()
f.close()
ls = jieba.lcut(t)
for word in excludes:
    while word in ls:
        ls.remove(word)
txt = ' '.join(ls)
w = wordcloud.WordCloud(width=1000, height=750, background_color='white', font_path='msyh.ttc', mask=mask)
w.generate(txt)
w.to_file('grwordcloudm.png')
